#ifndef DAUPROXY_CLIENT_DAUPROXYAPI_H
#define DAUPROXY_CLIENT_DAUPROXYAPI_H

#include "dauproxy.h"

namespace dauproxy_api_func
{
    /**
     * Defines all api function types for libdauproxy.so. These types define in here because we are use dynamic linker
     * loader for loading libdauproxy.so. You can check the dauproxy.h file for more details about api documentation.
     * */

    typedef int (*ProxySetLibraryPath)(char* _lib_path);
    typedef int (*ProxyInitLibrary)();
    typedef int (*ProxyReleaseLibrary)();

    typedef int (*ProxyAddDevice)(struct _proxy_dev_info_plus* devinfo,char  *dev_uuid,int *length);
    typedef int (*ProxyAddDevicePlus)(struct _proxy_dev_info_plus* devinfo, char  *dev_uuid);
    typedef int (*ProxyLogout)(char* dev_uuid);
    typedef int (*ProxyLogin)(char* dev_uuid);

    typedef int (*ProxyGetDeviceState)(char* dev_uuid);
    typedef int (*ProxyDeleteDevice)(char* dev_uuid);

    typedef int (*ProxyGetDeviceInfo)(char* dev_uuid, _dau_device_info &device_info);
    typedef int (*ProxyGetDevChannelInfo)(char* dev_uuid, _device_channel_info& channel_info);

    typedef int (*ProxyPtzControl)(char* dev_uuid, char* channel, int command, int param);

    typedef int (*ProxyGetLiveStreamUrl)(char* dev_uuid, char* channel, char* subchannel,  char* stream_url,int* url_length);
    typedef int (*ProxyGetVodStreamUrl)(char* dev_uuid, char* channel, char* subchannel,  char* begintime, char* endtime,
            uint32_t  vod_type, char* stream_url,int* url_length);
}

class DauProxyApi
{
private:
    DauProxyApi();
    ~DauProxyApi();
    void *pHandle;
public:
    dauproxy_api_func::ProxySetLibraryPath ProxySetLibraryPath;
    dauproxy_api_func::ProxyInitLibrary ProxyInitLibrary;
    dauproxy_api_func::ProxyReleaseLibrary ProxyReleaseLibrary;

    dauproxy_api_func::ProxyAddDevice ProxyAddDevice;
    dauproxy_api_func::ProxyAddDevicePlus ProxyAddDevicePlus;
    dauproxy_api_func::ProxyLogin ProxyLogin;
    dauproxy_api_func::ProxyLogout ProxyLogout;

    dauproxy_api_func::ProxyGetDeviceState ProxyGetDeviceState;
    dauproxy_api_func::ProxyDeleteDevice ProxyDeleteDevice;

    dauproxy_api_func::ProxyGetDeviceInfo ProxyGetDeviceInfo;
    dauproxy_api_func::ProxyGetDevChannelInfo ProxyGetDevChannelInfo;

    dauproxy_api_func::ProxyPtzControl ProxyPtzControl;
    dauproxy_api_func::ProxyGetVodStreamUrl ProxyGetVodStreamUrl;
    dauproxy_api_func::ProxyGetLiveStreamUrl ProxyGetLiveStreamUrl;


public:
    static DauProxyApi* GetInstance();
    int Init();
};

#endif //DAUPROXY_CLIENT_DAUPROXYAPI_H
